package com.mazong.serversecaa.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class MainController {

    @RequestMapping(value = "/")
    public String root() {
        return "/index";
    }

    @RequestMapping(value = "/index")
    public String index() {
        return "/index";
    }

    @RequestMapping(value = "/product/select")
    public String select() {
        return "/product/select";
    }

    @RequestMapping(value = "/product/insert")
    public String insert() {
        return "/product/insert";
    }

    @RequestMapping(value = "/product/update")
    public String update() {
        return "/product/update";
    }

    @RequestMapping(value = "/product/delete")
    public String delete() {
        return "/product/delete";
    }

    @RequestMapping(value = "/403")
    public String page403() {
        return "/403";
    }

    @RequestMapping(value = "/login")
    public String login() {
        return "/login";
    }

    @RequestMapping(value = "/login-error")
    public String loginFailed(Model model) {
        model.addAttribute("msg", "用户名或密码错误");
        return "/login";
    }
}
